package myapp;
use Dancer ':syntax';
use Template;

use Zuz::DBI;
use Zuz::Factory;
use Zuz::Sessions;
use Zuz::Users;

our $VERSION = '0.1';

# ANY PEOPLE
get '/' => sub {
    template 'index';
};

any '/*' => sub {
	my ($action_name) = splat;
	my $act = Zuz::Factory->create_action( ucfirst $action_name );
	$act->process();
};


#get '/get_session' => sub {
#	my $current_session = session->{zuz};
#	my %data = ( session_id => $current_session);
#	my $session = Zuz::Sessions->retrieve(%data);

#	return "zuz=|".$session->user_id->user_type."|";
#};


# ADMIN


# STUFF 
prefix '/stuff';

get '/*' => sub {
	my ($action_name) = splat;
	$action_name = ucfirst $action_name;
	my $act = Zuz::Factory->create_action("Stuff::$action_name");
	$act->process();
};


# CLIENTS
prefix '/client';

get '/*' => sub {
	my ($action_name) = splat;
	$action_name = ucfirst $action_name;
	my $act = Zuz::Factory->create_action("Client::$action_name");
	$act->process();
};


true;
